package com.chineseall.rebirth.bridge.pojo;

import java.util.Date;

import jmind.core.pojo.Pojo;

public class Book extends Pojo {

    /**
     * +bookId
     */
    // 待审核
    private static final String BOOK_STATUS_AUDITING = "01";
    // 审核未通过
    private static final String BOOK_STATUS_AUDIT_FAILURE = "02";
    // 屏蔽
    private static final String BOOK_STATUS_AUDIT_DENY = "03";
    // 审核通过
    private static final String BOOK_STATUS_AUDIT_SUCCESS = "04";

    // 连载
    private static final String BOOK_BOOKSTATUS_DOING = "01";
    // 暂停
    private static final String BOOK_BOOKSTATUS_PAUSE = "02";
    // 完本
    private static final String BOOK_BOOKSTATUS_DONE = "03";

    // 驻站作品
    private static final String BOOK_AUTHLEVEL_ZHUZHAN = "01";
    // 专属作品
    private static final String BOOK_AUTHLEVEL_ZHUANSHU = "02";
    // 授权作品
    private static final String BOOK_AUTHLEVEL_SHOUQUAN = "03";
    // vip作品
    private static final String BOOK_AUTHLEVEL_VIP = "04";

    // 买断签约
    private static final String BOOK_VIPAUTHLEVEL_MAIDUAN = "01";
    // 分成签约
    private static final String BOOK_VIPAUTHLEVEL_FENCHENG = "02";
    // 授权销售
    private static final String BOOK_VIPAUTHLEVEL_SHOUQUAN = "03";

    private static final String BOOK_DEFALUT_COVERIMAGEURL = "http://img.17k.com/images/default_cover.jpg";

    private static final String BOOK_COVER_URL_PREFIX = "http://img.17k.com/images/bookcover";

    // Fields
    private int id;

    private String actor;
    // 授权级别，04为VIP
    private String authLevel;
    private String bookName;
    // 由作者设置，状态为 01 连载、02 暂停、 03已完成
    private String bookstatus;
    private String broadcast;
    private String coverImageUrl;
    private Date createDate;
    private String firstissue;
    private String initial;
    private String introduction;
    private String isVip;
    private String keyWord;
    // 最后跟新时间
    private Date lastUpdateChapterDate;
    // 最新章节id
    private Integer lastUpdateChapterId;
    // 最小章节
    private String lastUpdateChapterName;
    // 书的状态
    private String status;
    private Integer wordCount;
    private Integer categoryId;
    private Integer author_id;
    // 是否已经出版
    private String isInprint;
    // 作者名
    private String authorPenname;

    private Integer commentWeekPrimeCount;
    private String isHtmled;
    private Integer applyAuditTime;
    private String collecting;
    private String isUpdateHighFrequency;
    private String collectSite;
    private Date auditedDate;
    private Date vipUpshelfDate;
    private Integer lastWeekWordCount;
    private Integer lastCommonChapterId;
    private String lastCommonChapterName;
    private String hasFixPrice;
    // vip授权级别
    private String vipAuthLevel;
    private Date updateDate;
    private String contractCode;
    private String resourceType;
    private Integer firstChapterId;
    private String firstChapterName;
    // 类别
    private String categoryName;
    private int channelId;
    private String channelName;

    /**
     * 连续更新相关
     */
    private Integer consecutiveDays;
    private Date lastConsecutiveDate;

    // Property accessors

    public Integer getId() {
        return this.id;
    }

    public void setId(Integer bookId) {
        this.id = bookId;
    }

    public String getActor() {
        return this.actor;
    }

    public void setActor(String actor) {
        this.actor = actor;
    }

    public String getAuthLevel() {
        return this.authLevel;
    }

    public void setAuthLevel(String authLevel) {
        this.authLevel = authLevel;
    }

    public String getBookName() {
        return this.bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    public String getBookstatus() {
        return this.bookstatus;
    }

    public void setBookstatus(String bookstatus) {
        this.bookstatus = bookstatus;
    }

    public String getBroadcast() {
        return this.broadcast;
    }

    public void setBroadcast(String broadcast) {
        this.broadcast = broadcast;
    }

    public String getCoverImageUrl() {
        return this.coverImageUrl;
    }

    public void setCoverImageUrl(String coverImageUrl) {
        this.coverImageUrl = coverImageUrl;
    }

    public Date getCreateDate() {
        return this.createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getFirstissue() {
        return this.firstissue;
    }

    public void setFirstissue(String firstissue) {
        this.firstissue = firstissue;
    }

    public String getInitial() {
        return this.initial;
    }

    public void setInitial(String initial) {
        this.initial = initial;
    }

    public String getIntroduction() {
        return this.introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    public String getIsVip() {
        return this.isVip;
    }

    public void setIsVip(String isVip) {
        this.isVip = isVip;
    }

    public String getKeyWord() {
        return this.keyWord;
    }

    public void setKeyWord(String keyWord) {
        this.keyWord = keyWord;
    }

    public Date getLastUpdateChapterDate() {
        return this.lastUpdateChapterDate;
    }

    public void setLastUpdateChapterDate(Date lastUpdateChapterDate) {
        this.lastUpdateChapterDate = lastUpdateChapterDate;
    }

    public Integer getLastUpdateChapterId() {
        return this.lastUpdateChapterId;
    }

    public void setLastUpdateChapterId(Integer lastUpdateChapterId) {
        this.lastUpdateChapterId = lastUpdateChapterId;
    }

    public String getStatus() {
        return this.status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Integer getWordCount() {
        return this.wordCount;
    }

    public void setWordCount(Integer wordCount) {
        this.wordCount = wordCount;
    }

    public Integer getCategoryId() {
        return this.categoryId;
    }

    public void setCategoryId(Integer categoryId) {
        this.categoryId = categoryId;
    }

    public Integer getAuthor_id() {
        return this.author_id;
    }

    public void setAuthor_id(Integer authorId) {
        this.author_id = authorId;
    }

    public String getIsInprint() {
        return this.isInprint;
    }

    public void setIsInprint(String isInprint) {
        this.isInprint = isInprint;
    }

    public String getAuthorPenname() {
        return this.authorPenname;
    }

    public void setAuthorPenname(String authorPenname) {
        this.authorPenname = authorPenname;
    }

    public String getLastUpdateChapterName() {
        return this.lastUpdateChapterName;
    }

    public void setLastUpdateChapterName(String lastUpdateChapterName) {
        this.lastUpdateChapterName = lastUpdateChapterName;
    }

    public Integer getCommentWeekPrimeCount() {
        return this.commentWeekPrimeCount;
    }

    public void setCommentWeekPrimeCount(Integer commentWeekPrimeCount) {
        this.commentWeekPrimeCount = commentWeekPrimeCount;
    }

    public String getIsHtmled() {
        return this.isHtmled;
    }

    public void setIsHtmled(String isHtmled) {
        this.isHtmled = isHtmled;
    }

    public Integer getApplyAuditTime() {
        return this.applyAuditTime;
    }

    public void setApplyAuditTime(Integer applyAuditTime) {
        this.applyAuditTime = applyAuditTime;
    }

    public String getCollecting() {
        return this.collecting;
    }

    public void setCollecting(String collecting) {
        this.collecting = collecting;
    }

    public String getIsUpdateHighFrequency() {
        return this.isUpdateHighFrequency;
    }

    public void setIsUpdateHighFrequency(String isUpdateHighFrequency) {
        this.isUpdateHighFrequency = isUpdateHighFrequency;
    }

    public String getCollectSite() {
        return this.collectSite;
    }

    public void setCollectSite(String collectSite) {
        this.collectSite = collectSite;
    }

    public Date getAuditedDate() {
        return this.auditedDate;
    }

    public void setAuditedDate(Date auditedDate) {
        this.auditedDate = auditedDate;
    }

    public Date getVipUpshelfDate() {
        return this.vipUpshelfDate;
    }

    public void setVipUpshelfDate(Date vipUpshelfDate) {
        this.vipUpshelfDate = vipUpshelfDate;
    }

    public Integer getLastWeekWordCount() {
        return this.lastWeekWordCount;
    }

    public void setLastWeekWordCount(Integer lastWeekWordCount) {
        this.lastWeekWordCount = lastWeekWordCount;
    }

    public Integer getLastCommonChapterId() {
        return this.lastCommonChapterId;
    }

    public void setLastCommonChapterId(Integer lastCommonChapterId) {
        this.lastCommonChapterId = lastCommonChapterId;
    }

    public String getLastCommonChapterName() {
        return this.lastCommonChapterName;
    }

    public void setLastCommonChapterName(String lastCommonChapterName) {
        this.lastCommonChapterName = lastCommonChapterName;
    }

    public String getHasFixPrice() {
        return this.hasFixPrice;
    }

    public void setHasFixPrice(String hasFixPrice) {
        this.hasFixPrice = hasFixPrice;
    }

    public String getVipAuthLevel() {
        return this.vipAuthLevel;
    }

    public void setVipAuthLevel(String vipAuthLevel) {
        this.vipAuthLevel = vipAuthLevel;
    }

    public Date getUpdateDate() {
        return this.updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public String getContractCode() {
        return this.contractCode;
    }

    public void setContractCode(String contractCode) {
        this.contractCode = contractCode;
    }

    public String getResourceType() {
        return this.resourceType;
    }

    public void setResourceType(String resourceType) {
        this.resourceType = resourceType;
    }

    public Integer getFirstChapterId() {
        return this.firstChapterId;
    }

    public void setFirstChapterId(Integer firstChapterId) {
        this.firstChapterId = firstChapterId;
    }

    public String getFirstChapterName() {
        return this.firstChapterName;
    }

    public void setFirstChapterName(String firstChapterName) {
        this.firstChapterName = firstChapterName;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public int getChannelId() {
        return channelId;
    }

    public void setChannelId(int channelId) {
        this.channelId = channelId;
    }

    public String getChannelName() {
        return channelName;
    }

    public void setChannelName(String channelName) {
        this.channelName = channelName;
    }

    // 书的状态描述
    public String statusDesc() {
        if (BOOK_STATUS_AUDITING.equals(status))
            return "待审核";

        if (BOOK_STATUS_AUDIT_FAILURE.equals(status))
            return "审核未通过";

        if (BOOK_STATUS_AUDIT_DENY.equals(status))
            return "屏蔽";

        if (BOOK_STATUS_AUDIT_SUCCESS.equals(status))
            return "审核通过";

        return "";
    }

    // 书的连载描述
    public String bookStatusDesc() {
        if (BOOK_BOOKSTATUS_DONE.equals(bookstatus))
            return "完成";

        if (BOOK_BOOKSTATUS_PAUSE.equals(bookstatus))
            return "暂停";

        if (BOOK_BOOKSTATUS_DOING.equals(bookstatus))
            return "连载";

        return "";
    }

    // 书的作品描述
    public String authLevelDesc() {
        if (BOOK_AUTHLEVEL_ZHUZHAN.equals(authLevel))
            return "驻站作品";

        if (BOOK_AUTHLEVEL_ZHUANSHU.equals(authLevel))
            return "专属作品";

        if (BOOK_AUTHLEVEL_SHOUQUAN.equals(authLevel))
            return "授权作品";

        if (BOOK_AUTHLEVEL_VIP.equals(authLevel))
            return "VIP作品";

        return "";

    }

    // 作者vip授权级别
    public String vipAuthLevelDesc() {
        if (BOOK_VIPAUTHLEVEL_MAIDUAN.equals(vipAuthLevel))
            return "买断签约";

        if (BOOK_VIPAUTHLEVEL_FENCHENG.equals(vipAuthLevel))
            return "分成签约";

        if (BOOK_VIPAUTHLEVEL_SHOUQUAN.equals(vipAuthLevel))
            return "授权销售";

        return "";
    }

    public String coverImageUrlDesc() {
        if (this.coverImageUrl == null) {
            return BOOK_DEFALUT_COVERIMAGEURL;
        } else {
            return BOOK_COVER_URL_PREFIX + this.coverImageUrl;
        }
    }

    public String convertBookCover(int type) {
        if (this.coverImageUrl == null) {
            return BOOK_DEFALUT_COVERIMAGEURL;
        }
        String bookCover = BOOK_COVER_URL_PREFIX + this.coverImageUrl;

        try {
            String[] img = coverImageUrl.split("\\.");
            bookCover = BOOK_COVER_URL_PREFIX + img[0] + "_" + type + "." + img[1];
        } catch (Exception e) {
            e.printStackTrace();
        }

        return bookCover;
    }

    public Integer getConsecutiveDays() {
        return consecutiveDays;
    }

    public void setConsecutiveDays(Integer consecutiveDays) {
        this.consecutiveDays = consecutiveDays;
    }

    public Date getLastConsecutiveDate() {
        return lastConsecutiveDate;
    }

    public void setLastConsecutiveDate(Date lastConsecutiveDate) {
        this.lastConsecutiveDate = lastConsecutiveDate;
    }
}
